import { Body, Controller, Get, Post, Res, HttpStatus, UploadedFile, UseInterceptors, HttpException, Query, Request } from '@nestjs/common';
import { FileInterceptor } from '@nestjs/platform-express';
import { InternetCelebrityGroup } from './internetCelebrityGroup.entity';
import { InternetCelebrityGroupService } from './internetCelebrityGroup.service';

import {
  apibefore
} from '../../router'
import utils from 'src/common/utils';
import { ValidRSAInterceptor } from 'src/interceptor/validRSA';
import { ValidTokenInterceptor } from 'src/interceptor/validToken';
@Controller(apibefore('/internetCelebrityGroup'))
@UseInterceptors(ValidTokenInterceptor)
@UseInterceptors(ValidRSAInterceptor)
export class InternetCelebrityGroupController {
  constructor(private readonly service: InternetCelebrityGroupService
  ) {
  }

  @Get('/findInfo')
  async findInfo(@Query() params, @Request() req){
    return await this.service.findInfo(req.headers.wx_user, params.id, params.account) 
  }

  
  @Get('/isExists')
  async isExists(@Query() params, @Request() req){
    return await this.service.isExists(req.headers.wx_user, params.account) 
  }

  @Get('/search')
  async Search(@Query() params, @Request() req){
    let { skip, take } = utils.getLimit(params.pageSize, params.pageIndex)
    return await this.service.search(req.headers.wx_user, params.keyword, skip, take)
  }
}
